package com.sz.biz.rpt.service.impl;

import com.sz.biz.rpt.entity.RptSaleProduct;
import com.sz.biz.rpt.entity.RptSaleSummary;
import com.sz.biz.rpt.entity.RptSaleSupplier;
import com.sz.biz.rpt.service.RptSaleSummaryService;
import com.sz.common.base.service.AbstractService;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * Function: //TODO ADD FUNCTION. <br>
 * Date: 2017年12月05日 11:47 <br>
 * Author: wentao.chang
 */
@Service
public class RptSaleSummaryServiceImpl extends AbstractService implements RptSaleSummaryService {
    @Override
    public int save(RptSaleSummary rss) {
        return dao.save("RptSaleSummaryMapper.insert", rss);
    }

    @Override
    public int update(RptSaleSummary rss) {
        return dao.update("RptSaleSummaryMapper.updateById", rss);
    }

    @Override
    public int delete(int id) {
        return dao.delete("RptSaleSummaryMapper.deleteById", id);
    }

    @Override
    public RptSaleSummary findById(int id) {
        return (RptSaleSummary) dao.findForObject("RptSaleSummaryMapper.selectById", id);
    }

    @Override
    public void deleteByDate(Date dateBegin) {
        dao.delete("RptSaleSummaryMapper.deleteByDate", dateBegin);
    }

    @Override
    public RptSaleSummary findByParam(Map<String, Object> params) {
        return (RptSaleSummary)dao.findForObject("RptSaleSummaryMapper.findByParam", params);
    }

    @Override
    public List<RptSaleSummary> findWeekByParam(Map<String, Object> params) {
        return  dao.findForList("RptSaleSummaryMapper.findWeekByParam", params,RptSaleSummary.class);
    }
}
